package com.touchalachs.core.ui;

import android.graphics.Point;
import android.graphics.Rect;
import android.view.MotionEvent;

import com.touchalachs.core.CanvasTool;
import com.touchalachs.core.Drawable;
import com.touchalachs.core.Touchable;

public abstract class BasicUIElement implements Drawable, Touchable{
	
	private Rect dimension;
	
	/**
	 * params in % [0..100]
	 * @param x
	 * @param y
	 * @param w
	 * @param h
	 * @param screenSize
	 */
	public BasicUIElement(int x, int y, int w, int h, Point screenSize) {
		dimension = CanvasTool.pctToScr(x, y, w, h, screenSize);
	}

	@Override
	public boolean onTouchEvent(MotionEvent event){
		return false;
	}
	
	/**
	 * absolute pixelPositions
	 * @param pointX
	 * @param pointY
	 * @return
	 */
	protected boolean isInBounds(int pointX, int pointY){
		return dimension.contains(pointX, pointY);
	}

	protected int getX() {
		return dimension.left;
	}

	protected int getY() {
		return dimension.top;
	}
	
	protected Rect getDimension() {
		return dimension;
	}
}
